package org.lztvn.elearning.service;

import java.util.List;

import org.lztvn.elearning.dao.IProductDao;
import org.lztvn.elearning.entities.Category;
import org.lztvn.elearning.entities.Product;
import org.springframework.transaction.annotation.Transactional;

@Transactional
public class CourseServiceImpl implements ICourseService {
	IProductDao dao;

	@Override
	public Long addCourse(Product c) {
		return dao.addProduct(c);
	}

	public void deleteCourse(Long idCors) {
		dao.deleteProduct(idCors);
	}

	@Override
	public void modifierCourse(Product c) {
		dao.modifierProduct(c);
	}

	@Override
	public List<Product> listCourse() {
		return dao.listProduct();
	}

	@Override
	public Product getCourse(Long idCors) {
		return dao.getProduct(idCors);
	}

	public void setDao(IProductDao dao) {
		this.dao = dao;
	}

	@Override
	public List<Product> listCourseInHome() {
		return dao.listProductInHome();
	}

	@Override
	public List<Product> listCourseByUserId(Long idUser, int position, int nb_course) {

		return dao.listProductByUserId(idUser, position, nb_course);
	}

	@Override
	public Long getNbCourseByUserId(Long idUser) {
		return dao.getNbProductByUserId(idUser);
	}

	@Override
	public List<Product> listCourseByLevel(Integer level) {
		// TODO Auto-generated method stub
		return dao.listProductByLevel(level);
	}
}
